﻿using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using LTJ.Entity;
using LTJ.Common;
using LTJ.Config;
using LTJ.FrameWork;

namespace LTJ.WebPage.UserManage.infoset
{
    public partial class selfinfoset : UserPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void edituser_Click(object sender, EventArgs e)
        {
            userinfo.rname = rname.Text.Trim();
            userinfo.ename = ename.Text.Trim();
            userinfo.phone = phone.Text;
            userinfo.bio = Utils.RemoveHtml(bio.Text.Trim());

            if (!Users.UpdateUser(userinfo))
            {
                base.RegisterStartupScript("PAGETEMPLATE", "用户编辑失败，请与管理员联系！");
                return;
            }
            OpLogs.CreateCompanyOPLog(userinfo, SASRequest.GetIP(), LTJ.Entity.OpAction.SelfInfoUpdate.ActionID, "");
            base.RegisterStartupScript("PAGE", "window.location.href='selfinfoset.aspx'");
        }

        #region Web 窗体设计器生成的代码

        override protected void OnInit(EventArgs e)
        {
            InitializeComponent();
            base.OnInit(e);
        }

        private void InitializeComponent()
        {
            rname.Text = userinfo.rname;
            ename.Text = userinfo.ename;
            phone.Text = userinfo.phone;
            bio.Text = userinfo.bio;
            edituser.Click += new EventHandler(edituser_Click);
        }

        #endregion
    }
}